<template>
  <div>
    <!-- 面包屑 -->
    <el-breadcrumb class="navigation">
      <el-breadcrumb-item :to="{ path: '/mapu' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>审核进程</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 主体区域 -->
    <el-card class="notice">
      <h4>&nbsp;&nbsp;审核进程</h4>
      <!--文件数据区域-->
      <el-table :data="progress" border stripe>
        <el-table-column label="#" type="index"></el-table-column>
        <el-table-column label="申请人" prop="applyName"></el-table-column>
        <el-table-column label="身份证号" prop="applyIdnum"></el-table-column>
        <el-table-column label="电话号码" prop="applyTele"></el-table-column>
        <el-table-column label="门牌类型" prop="applyHtypename"></el-table-column>
        <el-table-column label="审核状态" prop="applyStatus">
          <template slot-scope="scope">
            <el-tag type="success" v-if="scope.row.applyStatus === 0">
              审核中
            </el-tag>
            <el-tag type="danger" v-if="scope.row.applyStatus === 1">
              拒绝
            </el-tag>
            <el-tag type="danger" v-if="scope.row.applyStatus === 2">
              已通过
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="270px">
          <template slot-scope="scope">
            <el-button type="primary" size="mini" @click="details(scope.row.applyIdString)">
              详情
            </el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
    <!--详情-->
    <el-dialog :visible.sync="progressDialogVisible" width="36%">
      <el-descriptions title="申请详情" direction="vertical" border>
          <el-descriptions-item>{{ applyReason }}</el-descriptions-item>
        </el-descriptions>
        <span slot="footer" class="dialog-footer">
          <el-button type="primary" @click="progressDialogVisible = false">确 定</el-button>
        </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: 'Progress',
  data () {
    return {
      progress: [],
      applyReason: '',
      progressDialogVisible: false
    }
  },
  created () {
    // 请求申请进度
    this.getProgress()
  },
  methods: {
    // 详情页数据请求
    // 展示订单详细信息的对话框
    async details (row) {
      const applyid = row
      const { data: res } = await this.$axios.get('pogapply-record/getdetailed/' + applyid)
      const reason = res.data.replace(/<[^>]+>/g, '')
      this.applyReason = reason
      this.progressDialogVisible = true
    },
    async getProgress () {
      const { data: res } = await this.$axios.get('pogapply-record/getexamstatus')
      if (res.code !== 200) {
        return this.$message.error(res.message)
      }
      this.progress = res.data
    }
  }
}
</script>

<style scoped>
.navigation {
  padding: 10px;
}

.notice {
  margin-bottom: 40px;
  border-radius: 15px;
  box-shadow: 15px 15px 10px -12px #4c61a0;
}

h4 {
  padding-bottom: 8px;
  margin-bottom: 20px;
  border-bottom: 2px solid #4c61a0;
}

.el-table {
  margin-top: 15px;
  font-size: 14px;
}
</style>
